import { createClient } from '@supabase/supabase-js';

const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;

if (!supabaseUrl || !supabaseAnonKey) {
  throw new Error('Missing Supabase environment variables');
}

export const supabase = createClient(supabaseUrl, supabaseAnonKey);

// 数据库表名映射
export const TABLE_NAMES = {
  FUND_PLANS: 'fund_investment_plans',
  STOCK_PLANS: 'stock_investment_plans', 
  USER_SETTINGS: 'user_settings',
  PROFIT_CALCULATIONS: 'profit_calculations',
  USER_PROFILES: 'user_profiles', // 新的用户配置文件表
} as const;